import { createWebHashHistory, createRouter } from "vue-router";
import Login from '@/pages/Login.vue'
import Layout from "@/pages/layout/Layout.vue";

const routes = [
    {
        path: '/',
        redirect: '/login'
    },
    {
        path: '/login',
        component: Login
    },
    {
        path: '/layout',
        component: Layout,
        redirect: '/home',
        children: [
            {
                path: '/home',
                component: () => import('@/pages/home/Home.vue')
            },
        ]
    },
    {
        path: '/account',
        component: Layout,
        redirect: '/accountList',
        children: [
            {
                path: '/accountList',
                component: () => import('@/pages/account/AccountList.vue')
            },
            {
                path: '/accounAdd',
                component: () => import('@/pages/account/AccountAdd.vue')
            },
            {
                path: '/accountEdit',
                component: () => import('@/pages/account/AccountEdit.vue')
            },
            {
                path: '/accountCenter',
                component: () => import('@/pages/account/AccountCenter.vue')
            },
        ]
    },
    {
        path:'/goods',
        component: Layout,
        redirect: '/goodsList',
        children: [
            {
                path: '/goodsList',
                component: () => import('@/pages/goods/GoodsList.vue')
            },
            {
                path: '/goodsAdd',
                component: () => import('@/pages/goods/GoodsAdd.vue')
            },
            {
                path:'/goodsEdit',
                component: () => import('@/pages/goods/GoodsEdit.vue')
            }
        ]
    },

]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})
export default router